package io.github.kouleen.minecraft.plugin.redpacket;

import io.github.kouleen.minecraft.core.lang.annotation.MinecraftPluginAutoInject;
import io.github.kouleen.minecraft.core.lang.annotation.MinecraftPluginMain;
import io.github.kouleen.minecraft.plugin.MinecraftPluginRun;
import io.github.kouleen.minecraft.plugin.redpacket.manager.RedPacketManager;
import org.bukkit.plugin.java.JavaPlugin;

@MinecraftPluginMain
public class RedPacketPlugin extends JavaPlugin {

    @MinecraftPluginAutoInject
    private RedPacketManager redPacketManager;

    @Override
    public void onLoad() {
        MinecraftPluginRun.start(this,getClassLoader());
    }

    @Override
    public void onEnable() {
        redPacketManager.setupEconomy();
        // 保存默认配置
        saveDefaultConfig();
        getLogger().info("红包插件已启用!");
    }

    @Override
    public void onDisable() {
        // 保存未领取的红包
        redPacketManager.saveUnclaimedRedPackets();
        getLogger().info("红包插件已禁用!");
    }
}
